package com.shotgun.my.service.serviceImpl.defaultGroup.subGroup;

import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class BallUtil {

    public static void main(String[] args) {

        //红色
        String redStr = sort("02\n" +
                "22\n" +
                "25\n" +
                "30\n" +
                "06\n" +
                "01");

        //蓝色
        List<String> bluStrs = strToList("01\n" +
                "05\n" +
                "06\n" +
                "07");

        bluStrs.forEach(blu -> System.out.println(redStr + "-" + blu));

    }

    public static String sort(String ballStr) {
        return String.join(" ", strToList(ballStr));
    }

    public static List<String> strToList(String ballStr) {
        return Stream.of(Optional.ofNullable(ballStr).orElse("").split("\n"))
                .map(String::trim)
                .filter(StringUtils::isNotBlank)
                .sorted().collect(Collectors.toList());
    }


}
